﻿using CommunityToolkit.Maui.Alerts;
using CommunityToolkit.Maui.Core;
using CommunityToolkit.Maui.Views;
using CommunityToolkit.Mvvm.ComponentModel;
using System.Collections.ObjectModel;

namespace MauiApp1
{
    public partial class MainPage : ContentPage
    {

       
        public List<LimitItem> LItems { get; set; } = new List<LimitItem>();

        public MainPage()
        {
            InitializeComponent();
           // BindingContext = new MainPageViewModel();
        }        

        private void ShowPopup(CustomPickeView view)
        {
            this.ShowPopup(view);
        }

        private void dynamicTable_Clicked_1(object sender, Item e)
        {
            e.Age = 100;           
        }

        private async void Button_Clicked(object sender, EventArgs e)
        {
            //var t =  Toast.Make("123", ToastDuration.Short);          
            //await t.Show();
            var ss = new TableItemDetail<Item>(null);
            ss.DisplayByPercentage = 0.7;
            //ss.IsShowLoading = true;
            await PopupAction.DisplayPopup(ss);            
           // var pop = new TableItemDetail<Item>();            
           // pop.Size = new Size(Width * 0.7, Height * 0.7);            
           //await this.ShowPopupAsync(pop);
        }

        private void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e)
        {

        }

        //private async void mypicker_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    dropdownControl.IsLoading = true;
        //    await Task.Delay(1000);
        //    dropdownControl.IsLoading = false;
        //    dropdownControl.IsDisplayPickerControl = true;
        //}

        //private void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e)
        //{
        //    var r = sender as RadioButton;
        //    if (r != null)
        //    {
        //        LimitItem item = r.BindingContext as LimitItem;
        //        if (item != null)
        //        {
        //            dropdownControl.CustomPickeView.Close(item);
        //            foreach (var litem in LItems)
        //            {
        //                if (litem.Value == item.Value)
        //                {
        //                    litem.IsChecked = true;
        //                }
        //                else
        //                {
        //                    litem.IsChecked = false;
        //                }
        //            }                    
        //        }
        //    }
        //}
    }
}
